<?php

namespace Registro\Models;

class Users extends \Registro\Models\BaseModel {

    /**
     *
     * @var integer
     */
    public $user_id;

    /**
     *
     * @var string
     */
    public $user_email;

    /**
     *
     * @var string
     */
    public $user_password;

    /**
     *
     * @var string
     */
    public $user_firstname;

    /**
     *
     * @var string
     */
    public $user_lastname;

    /**
     *
     * @var string
     */
    public $user_displayname;

    /**
     *
     * @var integer
     */
    public $user_profile_id;

    /**
     *  A: active
     *  I: inactive
     *  B: banned
     *  S: suspended
     * @var string
     */
    public $user_status;

    public function initialize()
    {
        $this->hasMany( 'user_id', 'Registro\Models\Reg_events', 'event_created_by', array( 'alias' => 'Reg_events' ) );
        $this->hasMany( 'user_id', 'Registro\Models\Reg_events', 'event_modified_by', array( 'alias' => 'Reg_events' ) );
        $this->hasMany( 'user_id', 'Registro\Models\Reg_instruments', 'instrument_created_by', array( 'alias' => 'Reg_instruments' ) );
        $this->hasMany( 'user_id', 'Registro\Models\Reg_instruments', 'instrument_modified_by', array( 'alias' => 'Reg_instruments' ) );
        $this->hasMany( 'user_id', 'Registro\Models\Reg_sessions', 'session_user_id', array( 'alias' => 'Reg_sessions' ) );
        $this->belongsTo( 'user_profile_id', 'Registro\Models\UserProfiles', 'profile_id', array( 'alias' => 'userProfile' ) );
    }

    /**
     * Independent Column Mapping.
     */
    public function columnMap()
    {
        return array(
            'user_id' => 'user_id',
            'user_email' => 'user_email',
            'user_password' => 'user_password',
            'user_firstname' => 'user_firstname',
            'user_lastname' => 'user_lastname',
            'user_displayname' => 'user_displayname',
            'user_profile_id' => 'user_profile_id',
            'user_status' => 'user_status'
        );
    }

}
